package org.snacktest.module.screen;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.snackframework.core.ModelMap;
import org.snackframework.core.ScreenTemplate;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.support.rowset.SqlRowSet;

/**
 * 
 * @author allen Jun 25, 2010
 *
 */
public class SimpleScreen extends ScreenBase
{
	@Override
	public void handle(HttpServletRequest req, HttpServletResponse resp, ModelMap context)
	{
		SqlRowSet set=getJdbcTemplate().queryForRowSet("select * from userr");
		if(set.isBeforeFirst())
			set.next();
		String name=set.getString("name");
		context.put("user", /*req.getRemoteAddr()*/name);
	}
	@Override
	public void preHandle(HttpServletRequest req, HttpServletResponse resp, ModelMap context)
	{
		System.out.println("preHandle");
	}
}
